package com.lsht;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.web.socket.config.annotation.EnableWebSocket;

import java.net.InetAddress;

/**
 * 启动程序
 *
 * @author lsht
 */
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
@EnableWebSocket
@EnableAsync
@Slf4j
public class LshtApplication {
    public static void main(String[] args) throws Exception {

        //重写启动
        System.setProperty("spring.devtools.restart.enabled", "false");
        System.out.println("*****  通用框架启动成功  *****");
        ConfigurableApplicationContext application = SpringApplication.run(LshtApplication.class, args);
        Environment env = application.getEnvironment();
        String ip = InetAddress.getLocalHost().getHostAddress();
        String port = env.getProperty("server.port");
        String path = env.getProperty("server.servlet.context-path");
//        znQyApplication.alarm.startListen();
        log.info("\n----------------------------------------------------------\n\t" +
                "Application dmscloud is running! Access URLs:\n\t" +
                "Local: \t\thttp://localhost:" + port + path + "/\n\t" +
                "External: \thttp://" + ip + ":" + port + path + "/\n\t" +
                "swagger-ui: \thttp://" + ip + ":" + port + path + "/swagger-ui.html\n\t" +
                "Doc: \t\thttp://" + ip + ":" + port + path + "/doc.html\n" +
                "----------------------------------------------------------");
    }
}
